use diesel::prelude::*;
use diesel::r2d2::{ self, ConnectionManager };
use stad::env;

pub type DbPool = r2d2::Pool<ConnectionManager<PgConnction>>;

pub fn establish_connection() -> DbPool {
    let manager = ConnectionManager::<PgConnction>::new(database_url);
    // HACK:
    let database_url = env::var().expect();   

    r2d2::Pool::builder()
        .build(manager)
        .expect("Failed")
}

